using NUnit.Framework;
namespace Dogfight2008.Tests
{
  [TestFixture]
  public class CountdownFixture
  {
    [Test]
    public void Construct()
    {
      Countdown c = new Countdown(10);
    }

    [Test]
    public void StoppedIsFalseFromBeginning()
    {
      Countdown c = new Countdown(10);
      Assert.IsFalse(c.Stopped);
    }

    [Test, ExpectedException]
    public void TimeMustBePositive()
    {
      new Countdown(-1);
    }

    [Test]
    public void ZeroTimeIsOK()
    {
      new Countdown(0);
    }

    [Test]
    public void StoppedBecomesTrueAfterTimeHasPassed_InOneStep()
    {
      Countdown c = new Countdown(10);
      c.Tick(10);
      Assert.IsTrue(c.Stopped);
    }

    [Test]
    public void StoppedBecomesTrueAfterTimeHasPassed_InTwoSteps()
    {
      Countdown c = new Countdown(10);
      c.Tick(8);
      c.Tick(3);
      Assert.IsTrue(c.Stopped);
    }

    [Test]
    public void DoesNotStopWithSmallTick()
    {
      Countdown c = new Countdown(10);
      c.Tick(1);
      Assert.IsFalse(c.Stopped);
    }
  }
}
